
<ul>
    <li data-href="{php echo app_url('goods/list')}">
        <i class="iconal-homefill"></i>
        <span>首页</span>
    </li>
    <li class="jishi" data-href="{php echo app_url('order/personnelList')}">
        <i class="iconal-jishiguanli"></i>
        <span>技师</span>
    </li>
    <li class="gouwuche">
        <i class="iconal-gouwuche"></i><b></b>
        <span>购物车</span>
    </li>
    <li data-href="{php echo app_url('order/order')}">
        <i class="iconal-dingdan1"></i>
        <span>订单</span>
    </li>
    <li data-href="{php echo app_url('member/home')}">
        <i class="iconal-gerenzhongxin"></i>
        <span>我的</span>
    </li>
</ul>
<div id="cartDetails" style="display: none;transition-timing-function:ease-out;overflow:hidden;
position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.5);z-index:200;">
    <div style="  position: absolute;width: 94%;height: 85%;background-color: white;top: 5%;left: 3%;margin-bottom: auto;margin-top: auto;border-radius: 5px;box-shadow: 2px 2px 2px black;">
        <div style="  width: 80%;margin-left: 10%;height: 40px;font-size: 1.5em;line-height: 40px;color:#ff5c67;text-align: center;border-bottom: 1px solid #eee;box-sizing: border-box;">您选择的项目</div>
        <div style="  border-bottom: 1px solid #f0f0f0;overflow: auto;position: absolute;left: 5%;right: 5%;top: 50px;bottom: 50px;">
            <div class="cart_lists">
            </div>
        </div>
        <div style="width:100%;height:40px;position:absolute;left:0;bottom:10px;">
            <a style="width:30%;float:left;margin-left:2.5%;height:30px;background-color:#ff5c67;color:white;line-height:30px;text-align:center;border-radius:3px;margin-top:10px;"  onclick="continueBuy()">继续选购</a>
            <a style="width:30%;float:left;margin-left:2%;height:30px;background-color:#ff5c67;color:white;line-height:30px;text-align:center;border-radius:3px;margin-top:10px;" onclick="clearCart();">一键清除</a>
            <a style="width:30%;float:left;margin-left:2%;height:30px;background-color:#ff5c67;color:white;line-height:30px;text-align:center;border-radius:3px;margin-top:10px;" href="javascript:;">立即结算</a>
        </div>
    </div>
</div>
<div id='container' style="display: none"></div>
<script>
    //加载购物车数据
    updateCart();
    if(!sessionStorage.getItem('location')) {
        var map, geolocation;
        //加载地图，调用浏览器定位服务
        map = new AMap.Map('container', {
            resizeEnable: true
        });
        map.plugin('AMap.Geolocation', function () {
            geolocation = new AMap.Geolocation({
                enableHighAccuracy: true,//是否使用高精度定位，默认:true
                timeout: 10000,          //超过10秒后停止定位，默认：无穷大
                buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
                zoomToAccuracy: true,      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
                buttonPosition: 'RB'
            });
            map.addControl(geolocation);
            geolocation.getCurrentPosition();
            AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息
            AMap.event.addListener(geolocation, 'error', onError);      //返回定位出错信息
        });

        //解析定位结果
        function onComplete(data) {
            var str = ['定位成功'];
            console.log(data.position.getLng());
            str.push('经度：' + data.position.getLng());
            str.push('纬度：' + data.position.getLat());
            var location = {
                latitude: data.position.getLat(),
                longitude: data.position.getLng()
            };
            sessionStorage.setItem('location', JSON.stringify(location));
//            if (data.accuracy) {
//                str.push('精度：' + data.accuracy + ' 米');
//            }//如为IP精确定位结果则没有精度信息
//            str.push('是否经过偏移：' + (data.isConverted ? '是' : '否'));
        }

        //解析定位错误信息
        function onError(data) {
            console.log(data.message);
            $.toast('定位失败','text');
            sessionStorage.setItem('location', JSON.stringify({latitude: 31.299734, longitude: 121.531717}));
        }
    }
</script>